﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Altbrot.Yawr.Entities;
using Altbrot.Yawr.Rss;
using Altbrot.Yawr.Pls;
using System.ComponentModel;

namespace Altbrot.Yawr.Buslogic
{
    public class OnlineBuslogicManager : IBuslogicManager
    {
        #region IBuslogicManager Members

        public event UpdateProgressMethodDelegate OnUpdateProgress;

        public List<FeedItem> GetGenreList(string url, FeedItemDb db)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// Gets the genre list.
        /// </summary>
        /// <param name="url">The URL.</param>
        /// <returns></returns>
        public List<FeedItem> GetGenreList(string url)
        {
            RssParser parser = new RssParser();
            return parser.Parse(url, FeedItemCategory.Genre);
        }

        /// <summary>
        /// Gets the genre list.
        /// </summary>
        /// <param name="url">The URL.</param>
        /// <param name="offsetHours">The offset hours.</param>
        /// <returns></returns>
        public List<FeedItem> GetGenreList(string url, int offsetHours)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// Gets the station list.
        /// </summary>
        /// <param name="genre">The genre.</param>
        /// <param name="url">The URL.</param>
        /// <param name="tmpFilePath">The TMP file path.</param>
        /// <returns></returns>
        public List<FeedItem> GetStationList(string genre, string url)
        {
            RssParser parser = new RssParser();
            return parser.Parse(url, FeedItemCategory.Station);
        }

        public List<FeedItem> GetStationList(string genre, string url, FeedItemDb db)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// Gets the station urls.
        /// </summary>
        /// <param name="station">The station.</param>
        /// <param name="url">The URL.</param>
        /// <returns></returns>
        public List<FeedItem> GetStationUrls(FeedItem station, string tmpFilePath)
        {
            // get pls file, parse it and generate FeedItems
            PLSHelper helper = new PLSHelper();
            return helper.GetFeedItemsFormPlaylist(station.Link, tmpFilePath);
        }

        /// <summary>
        /// Updates the genre list.
        /// </summary>
        /// <param name="items">The items.</param>
        public void UpdateGenreList(List<FeedItem> items)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// Updates the station list.
        /// </summary>
        /// <param name="items">The items.</param>
        /// <param name="genre"></param>
        public void UpdateStationList(List<FeedItem> items, string genre, string tmpFilePath, AsyncOperation asyncOp)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// Searches the specified expression.
        /// </summary>
        /// <param name="expression">The expression.</param>
        /// <returns></returns>
        public List<FeedItem> Search(string expression)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// Gets the custom list.
        /// </summary>
        /// <returns></returns>
        public List<FeedItem> GetFavoritesList()
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// Sets the favorite.
        /// </summary>
        /// <param name="id">The id.</param>
        public void ToggleFavorite(Guid id)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// Updates the station.
        /// </summary>
        /// <param name="station">The station.</param>
        public void UpdateStation(FeedItem station)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
